# FROM base/kv:1.0
FROM registry.chentaihealth.cn/base/kv:1.0

# kill -9 $(ps aux | grep fpm | grep -v 'grep' | awk '{print $1}') && php-fpm82

RUN apk add --no-cache -t .php \
    nginx \
    php82 \
    php82-bcmath \
    php82-curl \
    php82-fileinfo \
    php82-fpm \
    php82-gd \
    php82-iconv \
    php82-mbstring \
    php82-mysqli \
    php82-pdo \
    php82-pdo_mysql \
    php82-session \
    php82-simplexml \
    php82-tokenizer \
    php82-xml \
    php82-xmlreader \
    php82-xmlwriter \
    php82-zip

# Copy default files.
RUN cd /etc/nginx && \
    cp nginx.conf  nginx.conf.default

# Copy depenency files.
COPY nginx/nginx.conf /etc/nginx/nginx.conf
COPY nginx/http.d/default.conf /etc/nginx/http.d/default.conf
COPY php/php-fpm.conf /etc/php82/php-fpm.conf
COPY php/php-fpm.d/www.conf /etc/php82/php-fpm.d/www.conf
COPY entrypoint.sh /usr/local/bin/entrypoint.sh

RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT /usr/local/bin/entrypoint.sh

# Export port
EXPOSE 8080
